﻿using System;
using System.Windows;
using Kitware.VTK;

namespace HelloVTKWPF
{
  /// <summary>
  /// Logique d'interaction pour MainWindow.xaml
  /// </summary>
  public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();
    }

    private void Form_Loaded(object sender, EventArgs e)
    {
      // Create a simple cube. A pipeline is created.
      vtkCubeSource cube = vtkCubeSource.New();

      vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
      mapper.SetInputConnection(cube.GetOutputPort());

      // The actor links the data pipeline to the rendering subsystem
      vtkActor actor = vtkActor.New();
      actor.SetMapper(mapper);

      // Create components of the rendering subsystem
      //
      vtkRenderer renderer = _renderControl.RenderWindow.GetRenderers().GetFirstRenderer();
      renderer.SetBackground(.2, .3, .4);

      // Add the actors to the renderer, set the window size
      renderer.AddActor(actor);
    }
  }
}
